<%= javascript_tag "window._token = '#{form_authenticity_token}'" if ActionController::Base.allow_forgery_protection %>
<script type="text/javascript" src="/javascripts/xtree.js"></script>
<script type="text/javascript" src="/javascripts/prototype.js"></script>
<link type="text/css" rel='stylesheet' href="/stylesheets/xtree.css" />
<script>
function show(id){
    new Ajax.Updater(
    "centerDiv",
    "/content_manage/show/"+id,
    {  method: 'get',
      asynchronous: true,
      evalScripts: true,
      parameters: 'authenticity_token=' + window._token  
    }
  );
}

       </script>
<script>
  <% def revTree(node,parent)
         tree="var tree#{node.id} = new WebFXTreeItem(\"#{node.name}\",\" javascript:show(#{node.id})\");\n "
         node.children.each do|child|
            tree << revTree(child,"tree#{node.id}")
         end
           tree << parent + ".add(tree#{node.id});\n"
           return tree;
     end %>
      var tree = new WebFXTree("内容管理");
      tree.setBehavior('classic');
      <%= revTree(Content.find_by_parent_id(0),"tree")%>
      document.write(tree);    
</script>


